home *** CD-ROM | disk | FTP | other *** search
- page 55,80
- title TAD: Time and date program for the PC/AT
- ;
- ;This program provides a DOS command to set the time and date into the
- ;BIOS real-time clock. The BIOS routine also sets the CMOS memory.
- ;Program has no effect on anything other than DOS 3.0 and PC/AT
- TERMINATE equ 4CH ;terminate program execution
- GETDATE equ 2AH ;read DOS date
- GETTIME equ 2CH ;read DOS time
- RTC equ 1AH ;access real-time clock
- WTIME equ 03H ; write the clock and CMOS
- WDATE equ 05h ; write the date and CMOS
- ;----------------------------------------------------------
- DOS macro fcn_code
- mov ah,fcn_code
- int 21H
- endm
- ;--------------------------
- BIOS macro int_no,fcn_code
- mov ah,fcn_code
- int int_no
- endm
- ;--------------------------
- B2BCD macro register
- mov al,register
- call B2_BCD
- mov register,al
- endm
- ;--------------------------
- ;Set so EX2BIN can convert program to COM format
- CSEG segment para public 'CODE'
- assume cs:CSEG, ds:CSEG
- ;
- org 100h
- START: jmp GO ;jump around data
- ;----------------------------------------
- BY10 db 10
- BY100 db 100
- ;----------------------------------------
- MAIN proc far
- GO: DOS GETDATE
- mov ax,cx
- div BY100
- xchg ah,al
- mov cx,ax
- B2BCD ch
- B2BCD cl
- B2BCD dh
- B2BCD dl
- BIOS RTC,WDATE
- DOS GETTIME
- B2BCD ch
- B2BCD cl
- B2BCD dh
- mov dl,0
- BIOS RTC,WTIME
- EXIT: xor al,al
- DOS TERMINATE
- MAIN endp
- ;------------------------------------
- B2_BCD proc near
- cbw
- div BY10
- shl al,1
- shl al,1
- shl al,1
- shl al,1
- or al,ah
- ret
- B2_BCD endp
- ;-----------------------------------
- CSEG ends
- end START
-